/**
 * 
 */
package labox.innovation.gameserver.network.clientpackets;

import labox.innovation.gameserver.model.ConsignmentCache;
import labox.innovation.gameserver.model.ConsignmentManager;
import labox.innovation.gameserver.model.actor.instance.FuzePcInstance;
import labox.innovation.gameserver.network.serverpackets.ConItemHighPacket;

/**
 * @author ljsh
 * @date 2010-5-6
 * @version 1.0
 * @description  寄售高级查找
 */
public class RequestConItemHigh extends L2GameClientPacket {
	private static final String _C_REQUESTCONITEMHIGH = "_C_RequestConItemHigh";


	private int firstGrade = -1;

	/**
	 * 二级类别
	 */
	private int sencondGrade = -1;

	/**
	 * 职业类别
	 * 
	 */
	private int profession = -1;

	/**
	 * 追星级别
	 */
	private int starLevele = -1;

	/**
	 * 物品品质
	 */
	private int itemQuality = -1;

	/**
	 * 物品可装备人物等级
	 */
	private int itemLevel = -1;

	/**
	 * 价格类型
	 */
	private int priceType = -1;

	/* (non-Javadoc)
	 * @see labox.innovation.gameserver.network.clientpackets.L2GameClientPacket#getType()
	 */
	@Override
	public String getType() {
		return _C_REQUESTCONITEMHIGH;
	}

	/* (non-Javadoc)
	 * @see labox.innovation.gameserver.network.clientpackets.L2GameClientPacket#readImpl()
	 */
	@Override
	protected void readImpl() {
		firstGrade = readByte();
		sencondGrade = readByte();
		profession = readByte();
		starLevele = readByte();
		itemQuality = readByte();
		itemLevel = readByte();
		priceType = readInt();
	}

	/* (non-Javadoc)
	 * @see labox.innovation.gameserver.network.clientpackets.L2GameClientPacket#runImpl()
	 */
	@Override
	protected void runImpl() {
		FuzePcInstance active = getClient().getActiveChar();
		if (active == null)
			return;
		ConsignmentCache cache=ConsignmentManager.getSearcheCache(active.getObjectId());
		cache.reset();
		int[] condition=new int[]{firstGrade, sencondGrade, profession, starLevele, itemQuality, itemLevel, priceType};
		cache.init(ConItemHighPacket.BY_H, condition);
		active.sendPacket(new ConItemHighPacket(active,cache.getSearchType(),condition));
		ConsignmentManager.addShelveItemListener(active.getObjectId());
	}

}
